package com.ac.cv.client;

import com.ac.cv.client.menu.PopupLabel;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DeckPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;


/**
 * Builder class for the page's body
 * @author CHATELLIER
 *
 */
public class Body {

	public static DeckPanel buildBody(){
		DeckPanel result = new DeckPanel();
		result.addStyleName("body");
		result.setAnimationEnabled(true);
		result.add(getPage1());
		result.add(getPage3());
		result.add(getPage2());
		result.add(getPage2());
		result.add(getPage2());
		result.addStyleName("bodySize");
		return result;
	}
	
	public static Panel getPage1(){
		PopupLabel label2 =new PopupLabel("rete", "ceci est un test", 0);
		EnhancedImage image = new EnhancedImage(new Image("resources/images/image.jpg"),new Image("resources/images/image.jpg"));
		final MailFormatter mailFormatter = new MailFormatter();
		Button showMail = new Button("mail");
		showMail.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				mailFormatter.center();
			}
		});
		VerticalPanel panel = new VerticalPanel();
		panel.addStyleName("greyBackground");
		panel.add(label2);
		panel.add(image);
		panel.add(showMail);
		return panel;
	}
	
	public static Panel getPage3(){
		Label label = new Label("test");
		PopupLabel label2 =new PopupLabel("rete", "ceci est un test", 1);
		EnhancedImage image = new EnhancedImage(new Image("resources/images/image.jpg"),new Image("resources/images/image.jpg"));
		VerticalPanel panel = new VerticalPanel();
		panel.addStyleName("greyBackground");
		panel.add(label);
		panel.add(label2);
		panel.add(image);
		return panel;
	}
	
	public static Panel getPage2(){
		Label label = new Label("Ceci est un test");
		VerticalPanel panel = new VerticalPanel();
		panel.addStyleName("grey2Background");
		panel.add(label);
		return panel;
	}
	
}
